﻿#include "../../../Public/Window/PTWWindow.h"
#include "../../../Public/System/PTSThread.h"

class PTWWindowImpl :public IPTWWindow
{
	uint32_t volatile m_Width;
	uint32_t volatile m_Height;

	void (PTPTR * volatile m_pOutputEventCallback)(void *pInputData, void *pUserData);
	void *volatile m_pOutputEventCallback_UserData;

	void (PTPTR * volatile m_pInputEventCallback)(void *pInputData, void *pUserData);
	void *volatile m_pInputEventCallback_UserData;

	//IPTWindow
	void OutputEventCallback_Hook(void *pUserData, void(PTPTR *pOutputEventCallback)(void *pUserData, void *pOutputData)) override;
	void InputEventCallback_Hook(void *pUserData, void(PTPTR *pInputCallback)(void *pUserData, void *pInputData)) override;
	void Parent_Set(PTWHWindow hWindowParent) override;
	void Position_Set(uint32_t TopLeftX, uint32_t TopLeftY) override;
	void Size_Set(uint32_t Width, uint32_t Height) override;


	HWND volatile m_hWindow_Cache;
	friend LRESULT CALLBACK PTWWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
	friend int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int);

public:
	//wWinMain线程调用
	//inline void Handle_Cache(HWND hWindow);
	//inline void Size_Cache(uint32_t width, uint32_t Height);
	inline PTWWindowImpl();
	inline ~PTWWindowImpl();

	//Cache CmdLine
	wchar_t *m_pCmdLine_Cache;

	//PTInvokeMain线程调用
	void TermminateMessagePump();
};